package com.datangnet.parking.basecommon.dao.impl;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;


public abstract class AbstractBasicDAO {
	
	@Autowired
	@Qualifier("sessionFactory4Read")
	private SessionFactory sessionFactory4Read;
	
	@Autowired
	@Qualifier("sessionFactory4Write")
	private SessionFactory sessionFactory4Write;
	
	@SuppressWarnings("rawtypes")
	@Autowired
	private RedisTemplate redisTemplate;
	
	@Autowired
	private StringRedisTemplate stringRedisTemplate;
	
	public Session currentSession4Write() {
		return sessionFactory4Write.getCurrentSession();
	}
	
	public Session currentSession4Read() {
		return sessionFactory4Read.getCurrentSession();
	}

	@SuppressWarnings("rawtypes")
	public RedisTemplate getRedisTemplate() {
		return redisTemplate;
	}

	public StringRedisTemplate getStringRedisTemplate() {
		return stringRedisTemplate;
	}
}
